package com.ygq.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.ygq.interceptor.teacherInterceptor;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    //拦截器对象
    @Autowired
    private teacherInterceptor teacherInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自定义拦截器对象----教师
        registry.addInterceptor(teacherInterceptor)
                .addPathPatterns("/teacher/**")//拦截所有教师端请求
                .excludePathPatterns("/teacher/login")//不拦截教师登录请求
                .excludePathPatterns("/teacher/ppt/getPPTById");

    }
}
